<template>
  <div class="moudleNameBox">
    <div class="control-head">
      <p class="section-name">{{title}}</p>
      <p class="reset" @click.stop="params.text = initText">重置</p>
    </div>
    <div class="moduleName">
      <div class="nameText">
        <input
          type="text"
          v-model="params.text"
          placeholder="请输入模板标题"
        />
      </div>
      <div class="show">
        <i
          class="iconfont icon-xianshi"
          @click.stop="changeUse(2)"
          v-if="params.useTitle == 1"
        ></i>
        <i
          class="iconfont icon-yincang"
          @click.stop="changeUse(1)"
          v-else
        ></i>
      </div>
    </div>
  </div>
</template>


<script>
export default {
  name: "",
  props: {
      params:{
          type:Object,
          default:() => {
              return {}
          }
      },
      initText:{
          type:String,
          default:''
      },
      title:{
          type:String,
          default:''
      }
  },
  data() {
    return {};
  },
  methods: {
    changeUse(e) {
      this.$setWithAction(this.params, "useTitle", e)
    }
  },
};
</script>

<style lang="scss" scoped>
.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 12px 0;
  font-size: 12px;
  font-weight: 400;
  color: #000000;
  .reset {
    font-size: 12px;
    font-weight: 400;
    color: #8e8e8e;
    cursor: pointer;
    user-select: none;
  }
  p {
    margin: 0;
  }
}
.moduleName {
  display: flex;
  align-items: center;
  justify-content: space-between;
  .nameText {
    width: 196px;
    height: 40px;
    background-color: #f6f7f9;
    border-radius: 4px;
    padding: 0 14px;
    input {
        width: 100%;
        height: 100%;
        border: none;
        outline: none;
        background-color: #f6f7f9;
    }
  }
  .show {
      width: 24px;
      height: 24px;
      background-color: #f6f7f9;
      border-radius: 4px;
      cursor: pointer;
      color: #000000;
  }
}
</style>